<?php
require __DIR__ . '/utils.php';
$pdo = db();
$pdo->exec("
CREATE TABLE IF NOT EXISTS logs (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    ts DATETIME DEFAULT CURRENT_TIMESTAMP,
    ip_anonymized TEXT NOT NULL,
    ua_hash TEXT NOT NULL,
    ua_raw TEXT,
    ref_hash TEXT,
    path TEXT NOT NULL,
    method TEXT NOT NULL,
    accept_lang TEXT,
    consent INTEGER DEFAULT 0,
    gps_lat REAL,
    gps_lng REAL,
    gps_accuracy INTEGER
);
");
echo "OK - tables ready";
